﻿using System.Collections.Generic;
using LitJson;


public class shopDataS2C
{
    private int ret;

    private Dictionary<string, shopData> shopListData;

    public shopDataS2C(string backData)
    {
        JsonData jd = JsonMapper.ToObject(backData);
        this.ret = (int)jd["ret"];
        if (ret == 0)
        {
            this.shopListData = new Dictionary<string, shopData> { };
            JsonData jdShopList = jd["list"];
            for (int i = 0; i < jdShopList.Count; i++)
            {
                shopData data = new shopData(jdShopList[i]);
                this.shopListData["shopTab" + i] = data;
            }
        }
    }

    public Dictionary<string, shopData> getShopList()
    {
        return shopListData;
    }


}

public class shopData
{
    public int page;
    public string pageName;
    public Dictionary<string, itemData> itemListData;

    public shopData(JsonData shopData)
    {
        this.page = (int)shopData["page"];
        this.pageName = (string)shopData["pageName"];
        this.itemListData = new Dictionary<string, itemData> { };
        for (int i = 0; i < shopData["list"].Count; i++)
        {
            itemData data = new itemData(shopData["list"][i]);
            this.itemListData["itemNum" + i] = data;

        }
    }
 
}


public class itemData
{
    public int itemid;
    public string itemName;
    public string itemDes;
    public int price;

    public itemData(JsonData itemData)
    {
        this.itemid = (int)itemData["itemid"];
        this.itemName = (string)itemData["itemName"];
        this.itemDes = (string)itemData["itemDes"];
        this.price = (int)itemData["price"];
    }

}


